# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: durbatuluk <dvdscripter@gmail.org>
# Contributor: Steve Ponsford <sp4d@lavabit.com>

pkgname=blackbox
pkgver=0.77
pkgrel=2
pkgdesc="A window manager for X11"
url="https://github.com/bbidulock/blackboxwm"
arch=('loong64' 'x86_64')
depends=('gcc-libs' 'libxft' 'libxext' 'libx11' 'libxt')
license=('MIT')
source=($pkgname-$pkgver.tar.gz::"https://github.com/bbidulock/blackboxwm/archive/$pkgver.tar.gz"
        120_include-ctime-header.patch
        blackbox.desktop)
sha256sums=('c614adae1a96edab02f2b0d00cd6b33080c5b9b11569fc254a069e1a9fcb8275'
            '9a376cfb873eac1d2b12d23350e6d4af480cc607fe5d56df6437a82883bd617b'
            'e0e9c0b954c90355a436311cf3875031b9fd796d1fafcee3f4dc9d875f040d35')

prepare() {
  cd blackboxwm-$pkgver
  patch -Np1 -i ../120_include-ctime-header.patch # Fix build
  sed -e '/AC_DISABLE_SHARED/d' -i configure.ac # Build shared library
  ./autogen.sh
}

build() {
  cd blackboxwm-$pkgver
  ./configure --prefix=/usr --mandir=/usr/share/man
  make
}

package() {
  cd blackboxwm-$pkgver
  make DESTDIR="$pkgdir" install
  install -D -m644 ../blackbox.desktop "$pkgdir"/usr/share/xsessions/blackbox.desktop
  install -D -m644 COPYING "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
